class MagicDictionary {
public:
    void buildDict(vector<string> dictionary) {
        for (auto& s : dictionary)
            _dictionary.insert(s);
    }

    bool search(string searchWord) {
        for (auto& c : searchWord)
        {
            char ch = c;
            for (int i = 'a'; i <= 'z'; i++)
            {
                if (i == ch)
                    continue;
                c = i;
                if (_dictionary.find(searchWord) != _dictionary.end())
                    return true;
            }
            c = ch;
        }
        return false;
    }

    unordered_set<string> _dictionary;
};

/**
 * Your MagicDictionary object will be instantiated and called as such:
 * MagicDictionary* obj = new MagicDictionary();
 * obj->buildDict(dictionary);
 * bool param_2 = obj->search(searchWord);
 */